<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var browserName = navigator.userAgent.toLowerCase(); 
        //区分手机端还是PC端
        isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(browserName));
        //判断浏览器
        isIE = /msie/i.test(browserName) && !/opera/.test(browserName);
        isIE6 = /msie 6.0/i.test(browserName);
        isIE7 = /msie 7.0/i.test(browserName);
        isIE8 = /msie 8.0/i.test(browserName);
        isFirefox = /firefox/i.test(browserName);
        isChrome = /chrome/i.test(browserName) && /webkit/i.test(browserName) && /mozilla/i.test(browserName);
        isOpera = /opera/i.test(browserName);
        isSafari = /webkit/i.test(browserName) &&!(/chrome/i.test(browserName) && /webkit/i.test(browserName) && /mozilla/i.test(browserName));
        //判断微信
        isWeixin = /micromessenger/i.test(browserName);
        console.log('是谷歌么', isChrome);
        console.log('是手机端么', isMobile);
    </script>
</body>
</html>